// Copyright (c) 2024, the Dart project authors.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:meta/meta.dart' show internal;

import '../arkobject.dart' hide ArkObject;
import '../arkreference.dart';
import '../types.dart';

// Simple ArkNumber implementation
class ArkNumber {
  final num value;
  
  ArkNumber(this.value);
  
  ArkNumber.fromReference(ArkReference reference) : value = 0; // TODO: implement
  
  static const type = ArkNumberType();
  static const nullableType = ArkNumberNullableType();

  static final _class = ArkClass.forName(r'ark/lang/Number');
  static final _ctorId = _class.constructorId(r'(D)V');
  
  ArkNumber.numberCtor(num number) : value = number;

  static final _doubleValueId =
      _class.instanceMethodId(r'doubleValue', r'()D');
  static final _intValueId =
      _class.instanceMethodId(r'intValue', r'()I');

  double doubleValue({bool releaseOriginal = false}) {
    // TODO: implement actual method call
    return value.toDouble();
  }
  
  int intValue({bool releaseOriginal = false}) {
    // TODO: implement actual method call
    return value.toInt();
  }
  
  @override
  String toString() => 'ArkNumber($value)';
}

// Simple type definitions
class ArkNumberType {
  const ArkNumberType();
}

class ArkNumberNullableType {
  const ArkNumberNullableType();
}